package sk.hackcraft.multibox.server;

import java.io.File;

import org.gstreamer.Gst;
import org.gstreamer.State;
import org.gstreamer.elements.PlayBin2;

public class Test {	
    public static void main(String[] args) {
        args = Gst.init("AudioPlayer", args);
        final PlayBin2 playbin = new PlayBin2("AudioPlayer");
        playbin.setInputFile(new File("/media/games/music/still_alive.mp3"));
        playbin.connect(new PlayBin2.ABOUT_TO_FINISH() {
			@Override
			public void aboutToFinish(PlayBin2 bin) {
				System.out.println("Music ended, replaying.");
				Gst.quit();
			}
		});
        
        playbin.setState(State.PLAYING);
        Gst.main();
        
        playbin.setState(State.NULL);
    }
}